package com.woorigil.social.taglib;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import org.apache.commons.lang.StringUtils;

import com.woorigil.social.domain.ProviderCode;

/**
 * provider logo url을 가져온다.
 */
public class ProviderLogoTag extends SimpleTagSupport {
	private String providerCode;


	@Override
	public void doTag() throws JspException, IOException {
		if (StringUtils.isBlank(providerCode)) {
			return;
		}
		
		String output = "";
		if (ProviderCode.CP == ProviderCode.valueOf(providerCode)) {
			output = "쿠팡";
		} else if (ProviderCode.WM == ProviderCode.valueOf(providerCode)) {
			output = "위메프";
		} else if (ProviderCode.GP == ProviderCode.valueOf(providerCode)) {
			output = "그루폰";
		} else if (ProviderCode.OC == ProviderCode.valueOf(providerCode)) {
			output = "오클락";
		} else if (ProviderCode.TM == ProviderCode.valueOf(providerCode)) {
			output = "티몬";
		}
		
		getJspContext().getOut().write(output);
	}
	
	public String getProviderCode() {
		return providerCode;
	}

	public void setProviderCode(String providerCode) {
		this.providerCode = providerCode;
	}	
}



